<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>考试工具</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <style>

        ul,li{ padding:0;margin:0;list-style:none}
        .tag{ color: red}
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row-fluid">
            <h2>V2考试</h2>

            <div class="form-group">
                <label for="url">考试地址</label>
                <input  class="form-control" id="url" placeholder="请输入考试地址">
            </div>
            <div class="form-group">
                <label for="cookie">Cookie</label>
                <input class="form-control" id="cookie" placeholder="请输入cookie">
            </div>
            <button id="searchBtn" class="btn btn-default">一键考试</button>
            <button id="home"  class="btn btn-default">回到首页</button>
            <span style="color: red">请勿重复点击按钮，一键答题考试完成后自动录入题库下次考试分会更高</span>
        </div>

    </div>
</body>
</html>
<script>
    $(function(){
        $("#home").on("click",function (){
            window.location.href="/index.html";
        })

        $("#searchBtn").on("click",function(){
            search();
        });

        $("#keyword").keydown(function(e){
            console.log(e.keyCode);
            if (e.keyCode == 13){
                search();
            }
        });

        function search(){
            var data = {
                url: $("#url").val(),
                    cookie: $("#cookie").val()
            }
            $.ajax({
                url: "/exam",
                data: JSON.stringify(data),
                method: "post",
                dataType: "json",
                contentType: 'application/json',
                success:function(data){
                    console.log(data.msg);
                    alert(data.msg);
                }

            })

        }


    });
</script>